public function CheckOutlet(icurrent, jcurrent, iDown, jDown, flowDirection)
if the downstream cell is a nodata value or out of grid space,
or points toward the current cell, the current cell
is the basin outlet.
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
integer,
|
intent(in) |
|
|
:: |
icurrent |
|
integer,
|
intent(in) |
|
|
:: |
jcurrent |
|
integer,
|
intent(in) |
|
|
:: |
iDown |
|
integer,
|
intent(in) |
|
|
:: |
jDown |
|
type(grid_integer),
|
intent(in) |
|
|
:: |
flowDirection |
|
Return Value
logical
Variables
Type |
Visibility | Attributes |
|
Name |
| Initial | |
integer,
|
public |
|
:: |
iback |
|
|
|
integer,
|
public |
|
:: |
jback |
|
|
|
Source Code
LOGICAL FUNCTION CheckOutlet &
!
(icurrent, jcurrent, iDown, jDown, flowDirection)
IMPLICIT NONE
INTEGER, INTENT(in) :: icurrent
INTEGER, INTENT(in) :: jcurrent
INTEGER, INTENT(in) :: iDown !riga cella di valle
INTEGER, INTENT(in) :: jDown !colonna cella di valle
TYPE(grid_integer), INTENT(in):: flowDirection
!local declarations:
INTEGER :: iback, jback
!------------------------------end of declaration -----------------------------
CheckOutlet = .FALSE.
!first case
IF ( IsOutOfGrid (iDown,jDown,flowDirection) ) THEN
CheckOutlet = .TRUE.
RETURN
END IF
!second case
IF ( flowDirection % mat(iDown,jDown) == flowDirection % nodata) THEN
CheckOutlet = .TRUE.
RETURN
END IF
!third case
CALL DownstreamCell (iDown,jDown,flowDirection%mat(iDown,jDown),iback,jback)
IF ( iback == icurrent .AND. jback == jcurrent) THEN
CheckOutlet = .TRUE.
RETURN
END IF
RETURN
END FUNCTION CheckOutlet